<?php
header ( 'content-type:text/html; charset=utf-8' );
@$login = $_REQUEST ['login'];
@$password = $_REQUEST ['password'];

require 'lib/db.php';

if (empty ( $login ) || empty ( $password )) {
	die(json_encode(array('status'=>false,'info'=>'tips：你不输入用户名和密码都想登录？滚蛋吧。')));
// 		$message = "登录信息不完整";
} 
$user = dbselect('select id,password from user where login=:login',array ('login' => $login ));


if (empty ( $user )) {
	die(json_encode(array('status'=>false,'info'=>'tips：用户名不存在')));
		$message = "用户名不存在";
}

if ($user ['password'] != $password) {
	die(json_encode(array('status'=>false,'info'=>'tips：密码错误')));
		$message = "密码错误";
} 

session_start();
$_SESSION['userid'] = $user['id'];

echo json_encode(array('status'=>true));


?>